#incldue<vector>

using namespace std;

//https://gitee.com/link?target=https%3A%2F%2Fleetcode.cn%2Fproblems%2Ffind-peak-element%2F
//该题目还是需要找出数组的二段性
int findPeakElement(vector<int>& nums)
{
    int left = 0, right = nums.size() - 1;
    while(left < right)
    {
        int mid = left + (right -left + 1)/2;
        if(nums[mid] > nums[mid - 1]) left = mid;//符合该条件此区间两数递减，故峰值必定在mid左边
        else right = mid -1;//否则区间这两个数递增，故峰值必定在mid - 1右边
    }
    return left;
}


